package com.shrct.businessprocess.customerservice.impl;

import com.shrct.businessprocess.customerservice.RCServiceRecord;
import com.shrct.businessprocess.customerservice.RCServiceRecordDAO;
import com.shrct.businessprocess.customerservice.events.RCServiceRecordEventsManager;
import com.shrct.businessprocess.customerservice.impl.RCServiceRecordImpl;
import edu.fudan.mylang.pf.BaseDAOService;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrct.businessprocess.customerservice.RCServiceRecordDAO")
public class RCServiceRecordDAOImpl extends BaseDAOService<RCServiceRecord> implements RCServiceRecordDAO {
  @Autowired
  private RCServiceRecordEventsManager eventsManager;
  
  public void create(final Procedure1<? super RCServiceRecord> preInit) {RCServiceRecord rCServiceRecord=RCServiceRecordImpl.create(getObjectFactory());
    final Procedure1<RCServiceRecord> _function = new Procedure1<RCServiceRecord>() {
        public void apply(final RCServiceRecord it) {
          preInit.apply(it);
          RCServiceRecordDAOImpl.this.eventsManager.fireCreated(it);
        }
      };
    ObjectExtensions.<RCServiceRecord>operator_doubleArrow(rCServiceRecord, _function);
  }
  
  public void delete(final RCServiceRecord serviceRecord, final Procedure1<? super RCServiceRecord> preAction) {
    preAction.apply(null);getObjectFactory().delete(serviceRecord);
    
  }
}
